#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
    ios::sync_with_stdio(false);
    int a, b, c, d;
    int t;
    cin >> t;
    while(t--)
    {
        set<int> s;
        cin >> a >> b >> c >> d;
        s.insert(a);
        s.insert(b);
        s.insert(c);
        s.insert(d);
        if(s.size() == 1) cout << "YES\n";
        else cout << "NO\n";
    }
}